// Open dataset
use ../data/data_final.dta, clear

//Table 1:
gen table1 = .
replace table1 = 1 if context1 == 1 & elecyear == 1 // elected governor in the previous election ran for reelection for the same party
replace table1 = 2 if context2 == 1 & elecyear == 1  // elected governor in the previous election ran for reelection for another party
replace table1 = 3 if context3 == 1 & elecyear == 1  // party is heading coalition

table table1 year if included==1 & elecyear==1, row col by(reelect)
* or
tab table1 reelect if included==1 & year==1994, row
tab table1 reelect if included==1 & year==1998, row
tab table1 reelect if included==1 & year==2002, row
tab table1 reelect if included==1 & year==2014, row
tab table1 reelect if included==1 & year==2006, row
tab table1 reelect if included==1 & year==2010, row
